package com.wf.it.hpwebplan.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitMqConfig {

    @Bean
    public Queue smsQueue(){
        return new Queue("ask_sms");
    }
    @Bean
    public DirectExchange smsExchange(){
        return new DirectExchange("exchange.direct1");
    }
    @Bean
    public Binding smsBiding(Queue smsQueue, DirectExchange smsExchange) {
        // 将路由使用路由键绑定到交换器上
        return BindingBuilder.bind(smsQueue).to(smsExchange).with("sms.routing.key");
    }



}
